/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.grt192.controller.cannonbot;

/**
 *
 * @author Vsunder
 */
import com.grt192.core.EventController;
import com.grt192.event.component.ButtonListener;
import com.grt192.mechanism.GRTDriverStation;
import com.grt192.sensor.GRTJoystick;
import com.grt192.event.SensorEvent;
import com.grt192.mechanism.cannonbot.CBArm;

public class CBArmController extends EventController implements ButtonListener {

	private GRTDriverStation ds;
	private CBArm arm;

	public CBArmController(GRTDriverStation ds, CBArm arm) {
		super();
		this.ds = ds;
		((GRTJoystick) ds.getSensor("rightJoystick")).addButtonListener(this);
		((GRTJoystick) ds.getSensor("leftJoystick")).addButtonListener(this);
		this.arm = arm;
	}

	public void buttonUp(SensorEvent e, String key) {
		if (key.equals("Button2")) {
			arm.toggleArm();
		} else if (key.equals("Button6")) {
			arm.extend();
		} else if (key.equals("Button7")) {
			arm.retract();
		}
	}

	public void buttonDown(SensorEvent e, String key) {
	}

}